package org.jypj.dev.model;

import com.google.gson.Gson;

import java.io.*;

/**
 * 消息表 通知表
 *
 * @author chenyu
 */
public class NoticeMessage implements java.io.Serializable {

    private static final long serialVersionUID = 1L;

    private String id; //主键ID
    private String title; //消息标题
    private String subContent; //摘要
    private String coverPic; //封面图片的地址
    private String coverPicAllUrl;//封面全路径
    private String coverPicName; //封面图片名称
    private String contentFile; //文件内容的Url
    private String contentFileAllUrl;//封面全路径
    private String contentFileName; //内容附件名称
    private String content; //消息的纯文本内容
    private String contentHtml; //消息的html 内容
    private String createTime; //消息创建时间
    private String modifyTime; //修改时间
    private String createUser; //创建人
    private String modifyUser; //修改人
    private String sendTime; //消息发送时间
    private String sendUserName; //发送者姓名
    private String sendUserNum; //发送者编号
    private int status; //0，未发送，1，已发送

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return this.title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getSubContent() {
        return this.subContent;
    }

    public void setSubContent(String subContent) {
        this.subContent = subContent;
    }

    public String getCoverPic() {
        return this.coverPic;
    }

    public void setCoverPic(String coverPic) {
        this.coverPic = coverPic;
    }

    public String getCoverPicName() {
        return this.coverPicName;
    }

    public void setCoverPicName(String coverPicName) {
        this.coverPicName = coverPicName;
    }

    public String getContentFile() {
        return this.contentFile;
    }

    public void setContentFile(String contentFile) {
        this.contentFile = contentFile;
    }

    public String getContentFileName() {
        return this.contentFileName;
    }

    public void setContentFileName(String contentFileName) {
        this.contentFileName = contentFileName;
    }

    public String getContent() {
        return this.content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContentHtml() {
        return this.contentHtml;
    }

    public void setContentHtml(String contentHtml) {
        this.contentHtml = contentHtml;
    }

    public String getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getModifyTime() {
        return this.modifyTime;
    }

    public void setModifyTime(String modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getCreateUser() {
        return this.createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public String getModifyUser() {
        return this.modifyUser;
    }

    public void setModifyUser(String modifyUser) {
        this.modifyUser = modifyUser;
    }

    public String getSendTime() {
        return this.sendTime;
    }

    public void setSendTime(String sendTime) {
        this.sendTime = sendTime;
    }

    public String getSendUserName() {
        return this.sendUserName;
    }

    public void setSendUserName(String sendUserName) {
        this.sendUserName = sendUserName;
    }

    public String getSendUserNum() {
        return this.sendUserNum;
    }

    public void setSendUserNum(String sendUserNum) {
        this.sendUserNum = sendUserNum;
    }

    public int getStatus() {
        return this.status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getCoverPicAllUrl() {
        return coverPicAllUrl;
    }

    public void setCoverPicAllUrl(String coverPicAllUrl) {
        this.coverPicAllUrl = coverPicAllUrl;
    }

    public String getContentFileAllUrl() {
        return contentFileAllUrl;
    }

    public void setContentFileAllUrl(String contentFileAllUrl) {
        this.contentFileAllUrl = contentFileAllUrl;
    }

    /**
     * 对象深度克隆
     *
     * @return
     * @throws IOException
     * @throws ClassNotFoundException
     */
    public NoticeMessage deepClone() throws IOException, ClassNotFoundException {//将对象写到流里
        ByteArrayOutputStream bo = new ByteArrayOutputStream();
        ObjectOutputStream oo = new ObjectOutputStream(bo);
        oo.writeObject(this);//从流里读出来
        ByteArrayInputStream bi = new ByteArrayInputStream(bo.toByteArray());
        ObjectInputStream oi = new ObjectInputStream(bi);
        return (NoticeMessage) oi.readObject();
    }

    @Override
    public String toString() {

        return new Gson().toJson(this);
    }

}